package com.jt.safe.state


import com.jt.safe.exception.HubException


sealed class ViewState<out T> {
    companion object {
        fun <T> onHubSuccess(data: T,int: Int): ViewState<T> = Success(data,int)
        fun <T> onHubLoading(): ViewState<T> = Loading
        fun <T> onHubError(error: HubException,int: Int): ViewState<T> = Error(error,int)
    }

    object Loading : ViewState<Nothing>()
    data class Success<out T>(val data: T,val int: Int) : ViewState<T>()
    data class Error(val error: HubException,val int: Int) : ViewState<Nothing>()
}

